'''
Created on Jul 1, 2013

@author: root
'''

from __future__ import print_function
import os, sys
from os.path import join
import fnmatch
import fileinput
import re

filepath = '/home/zhc/Downloads'
filetype = '*.txt'
regex = '\/.*\/'
newstring = ''

for root, dirs, files in os.walk(filepath, True):
    print ('a')
    for f in files:
        if fnmatch.fnmatch(f, filetype):
            print ('join(root, f):' + join(root, f))
            for line in fileinput.input(join(root, f), inplace=1, mode='r'):
                line.find() 
                print(line, end='')
                # print(line, end='', file=sys.stdout)

